package com.gitee.huxing.course;

import com.gitee.huxing.api.Order;
import com.gitee.huxing.api.OrderService;
import com.gitee.huxing.api.User;
import com.gitee.huxing.api.UserService;
import com.gitee.huxing.framework.core.ServiceRpcFrx;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class RpcDemoConsumeApplication {

    public static void main(String[] args) {
        // 通过动态增强处理
        UserService userService1 = ServiceRpcFrx.create(UserService.class,
                "http://localhost:8091/");
        User user1 = userService1.findById(1);
        System.out.println("find user id=1 from server: " + user1.getName());

        // 通过aop处理异常
        OrderService orderService = ServiceRpcFrx.createTest(OrderService.class,
                "http://localhost:8091/");
        Order order = orderService.findOrderById(1);
        System.out.println("find order id=1 from server: " + order.getName());
    }
}
